package org.jmetrix.samples.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.jmetrix.et.ExecutionTimeAspect;

/**
 * @author Konstantin Kuzmin
 * @version $Revision$
 * @since 21.04.12
 */
@Aspect
public class ProcessOrderExecutionTime extends ExecutionTimeAspect {
    @Override
    protected String getGroup(ProceedingJoinPoint pjp) {
        return pjp.getSignature().getName();
    }

    @Around("call (protected void org.jmetrix.samples.application.OrderManager.saveOrder(..))")
    public Object saveOrder(final ProceedingJoinPoint pjp) throws Throwable {
        return super.measure(pjp);
    }

    @Around("call (protected void org.jmetrix.samples.application.OrderManager.createInvoice(..))")
    public Object createInvoice(final ProceedingJoinPoint pjp) throws Throwable {
        return super.measure(pjp);
    }
}
